/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa036.kiss.Entity;

/**
 *
 * @author Vasa
 */
public class BilancePlatebDTO {
    private Long id;
    private Double platba;
    private StudentDTO student;

    public Long getId() {
        return id;
    }

    public BilancePlatebDTO setId ( final Long id ) {

    if ( id != null ) {

      this.id = new Long ( id.longValue () );
    }

    return this;
  }

    public Double getPlatba() {
        return platba;
    }

    public void setPlatba(Double platba) {
        this.platba = platba;
    }

    public StudentDTO getStudent() {
        return student;
    }

    public void setStudent(StudentDTO student) {
        this.student = student;
    }

    @Override
    public String toString() {
        return "BilancePlatebDTO{" + "id=" + id + ", platba=" + platba + ", student=" + student + '}';
    }
    
    @Override
  public boolean equals ( final Object rhs ) {

    if ( this == rhs ) return true;

    if ( rhs == null ) return false;

    if ( this.getClass () != rhs.getClass () ) return false;

    BilancePlatebDTO c = (BilancePlatebDTO) rhs;

    return this.id == null ? c.id == null : this.id.equals ( c.id ) &&
        this.platba == null ? c.platba == null : this.platba.equals ( c.platba ) &&
        this.student == null ? c.student == null : this.student.equals ( c.student );
  }

  @Override
  public int hashCode () {

    final int[] hashCodes = {
        (this.id == null) ? 0 : this.id.hashCode (),
        (this.platba == null) ? 0 : this.platba.hashCode (),
        (this.student == null) ? 0 : this.student.hashCode ()
    };

    int hash = 17;
    for ( final int currentHashCode: hashCodes ) {

      hash = hash * 31 + currentHashCode;
    }

    return hash;
  }
    @Override
    public Object clone () {

    try {

      return ( (BilancePlatebDTO) super.clone () ).setId ( this.id );
    } catch ( CloneNotSupportedException ex ) {

      assert false: "CloneNotSupportedException thrown";
      return null;
    }
  }
     public void checkState () {

    final boolean noPlatba = this.platba == null;

    if ( noPlatba )  {

      throw new IllegalStateException ( "Platba musi byt nastaveny" );
    }
  }
}
